﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CMS.Repository.Translator
{
    /// <summary>
    /// LevelTranslator
    /// Author:Fiona Pan
    /// </summary>
    public class LevelTranslator
    {
        /// <summary>
        /// Transfer EFLevel to ModelLevel
        /// </summary>
        /// <param name="inputLevel">EFLevel inputLevel</param>
        /// <returns>ModelLevel</returns>
        public static CMS.Model.Level ToLevelModel(Level inputLevel)
        {
            CMS.Model.Level outputLevel = new Model.Level();
            outputLevel.LevelId = inputLevel.LevelId;
            outputLevel.LevelName = inputLevel.LevelName;
            return outputLevel;
        }
        /// <summary>
        /// Transfer ModelLevel to EFLevel
        /// </summary>
        /// <param name="inputLevel">ModelLevel inputLevel</param>
        /// <returns>EFLevel outputLevel</returns>
        public static Level ToLevelEF(CMS.Model.Level inputLevel)
        {
            Level outputLevel = new Level();
            outputLevel.LevelId = inputLevel.LevelId;
            outputLevel.LevelName = inputLevel.LevelName;
            return outputLevel;
        }
        /// <summary>
        /// Transfer LevelEFList to LevelModelList
        /// </summary>
        /// <param name="inputLevelList">List of LevelEF</param>
        /// <returns>List of LevelModel</returns>
        public static List<Model.Level> ToLevelModelList(List<Level> inputLevelList)
        {
            List<Model.Level> outputLevelList = new List<Model.Level>();
            foreach (Level levelEF in inputLevelList)
            {
                Model.Level levelModel = new Model.Level();
                levelModel.LevelId = levelEF.LevelId;
                levelModel.LevelName = levelEF.LevelName;
                outputLevelList.Add(levelModel);
            }
            return outputLevelList;
        }
        /// <summary>
        /// Transfer LevelModelList to LevelEFList
        /// </summary>
        /// <param name="inputLevelList">List of LevelModel</param>
        /// <returns>List of LevelEF</returns>
        public static List<Level> ToLevelEFList(List<Model.Level> inputLevelList)
        {
            List<Level> outputLevelList = new List<Level>();
            foreach (Model.Level LevelModel in inputLevelList)
            {
                Level levelEF = new Level();
                levelEF.LevelId = LevelModel.LevelId;
                levelEF.LevelName = LevelModel.LevelName;
                outputLevelList.Add(levelEF);
            }
            return outputLevelList;
        }
    }
}
